package com.itheima.mapper.admin;

import com.itheima.pojo.admin.Dish;
import com.itheima.pojo.admin.Flavors;
import com.itheima.pojo.admin.FlavorsById;
import com.itheima.pojo.admin.SetmealRelation;
import com.itheima.pojo.client.selectDishListVo.SelectDishListVo;
import com.itheima.pojo.client.selectDishListVo.SelectFlavorListVo;
import com.itheima.pojo.client.selectSetmealDishByIdVo.SelectSetmealDishByIdVo;
import com.itheima.pojo.client.selectSetmealDishByIdVo.SelectSetmealDishFlavorListVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;


import java.util.List;

/**
 * @author ChenJunJie
 * @date 2022/6/13 16:19
 * 菜品的mapper层
 */
@Mapper
public interface DishMapper {

    //新增菜品
    int dishAdd(Dish<Flavors> dish);

    //新增口味
    int flavorsAdd(Flavors flavors);

    //菜品分页查询
    List<Dish<Flavors>> dishPagination(
            @Param("name") String name,
            @Param("page") Integer page,
            @Param("pageSize") Integer pageSize,
            @Param("type") String type);

    //通过菜品名称与类型查询菜品
    List<Dish<Flavors>> dishSelectByNameAndType(@Param("name") String name, @Param("type") String type);

    //通过菜品id查询菜品
    Dish<FlavorsById> dishSelectById(@Param("id") String id);

    //通过菜品id查询口味
    List<FlavorsById> flavorsSelectById(@Param("id") String id);

    //通过菜品id修改菜品
    int dishUpdateById(Dish<Flavors> dish);

    //通过口味id修改口味
    int flavorsUpdateById(FlavorsById flavorsById);

    //通过菜品id删除口味
    int flavorsDeleteById(@Param("id") String id);

    //通过菜品id删除菜品
    int dishDeleteById(@Param("id") String id);

    //通过所属分类id查询菜品
    List<Dish<FlavorsById>> dishSelectByCategoryId(@Param("categoryId") String categoryId);

    //通过菜品id修改状态
    int dishUpdateStatusById(@Param("id") String id,@Param("status") Integer status);

    //---------------------------------------------移动端---------------------------------------------
    //菜品模块：查询菜品列表
    List<SelectDishListVo> selectDishList (@Param("categoryId") String categoryId , @Param("status") Integer status);

    //菜品模块：通过菜品id查询口味列表
    List<SelectFlavorListVo> selectFlavorList(@Param("dishList") List<SelectDishListVo> dishList);

    //分类模块：通过菜品id查询菜品
    List<SelectSetmealDishByIdVo> selectSetmealDishById(@Param("setmealRelations")List<SetmealRelation> setmealRelations);

    //分类模块：通过菜品id查询口味列表
    List<SelectSetmealDishFlavorListVo> selectSetmealDishFlavorList(@Param("dishList") List<SelectSetmealDishByIdVo> dishList);


}
